import { Dayjs } from 'dayjs';

export interface DatingInfoDetail {
	id?: number;
	datingType?: string;
	datingTheme?: string;
	timeInfo?: Dayjs[] | string[] | any[] | null;
	startTime?: Dayjs | string | null;
	content?: string;
	imageIds?: string | null;
	location?: string | string[];
	payMoney?: number;
	fileInfoVoList?: any[];
	provinceId?: number | null;
	cityId?: number | null;
	districtId?: number | null;
	topFlag?: boolean | null;
	userId?: number | null;
}

export const labelMap = {
	datingType: { name: 'datingType', label: '约会类型' },
	datingTheme: { name: 'datingTheme', label: '约会主题' },
	timeInfo: { name: 'timeInfo', label: '约会时间' },
	content: { name: 'content', label: '约会内容' },
	imageIds: { name: 'imageIds', label: '约会图片' },
	location: { name: 'location', label: '约会地点' },
	payMoney: { name: 'payMoney', label: '应邀金额' },
	topFlag: { name: 'topFlag', label: '是否置顶' },
	userId: { name: 'userId', label: '约会创建人' },
};

export const rulesRef: any = {
	datingType: [
		{
			required: true,
			message: '约会类型不能为空！',
		},
	],
	datingTheme: [
		{
			required: true,
			message: '约会主题不能为空！',
		},
	],
	timeInfo: [
		{
			required: true,
			message: '约会时间不能为空！',
			validator: (rule, value) => {
				if (!value || !Array.isArray(value) || value.length === 0) {
					return Promise.reject('约会时间不能为空，且必须是一个非空数组！');
				}
				return Promise.resolve();
			},
		},
	],
	content: [
		{
			required: true,
			message: '约会内容不能为空！',
		},
	],
	imageIds: [
		{
			required: true,
			message: '约会图片不能为空！',
			trigger: 'blur',
		},
	],
	location: [
		{
			required: true,
			message: '约会地点不能为空！',
		},
	],
	userId: [
		{
			required: true,
			message: '约会创建人不能为空！',
		},
	],
};

export const topFlagList = [
	{ label: '是', value: true },
	{ label: '否', value: false },
];
